# include "MeshMaterial.h"

namespace WuguiEngine
{
	namespace Graphics
	{
		MeshMaterial::MeshMaterial(GraphicsDevice* device)
		{
			pDevice = device;
			normalMap = NULL;
			diffuseMap = NULL;
			specularMap = NULL;
		}

		void MeshMaterial::SetDiffuseMap(string filename)
		{
			diffuseMap = new GameTexture(pDevice, filename);
		}

		void MeshMaterial::SetNormalMap(string filename)
		{
			normalMap = new GameTexture(pDevice, filename);
		}

		void MeshMaterial::SetSpecularMap(string filename)
		{
			specularMap = new GameTexture(pDevice, filename);
		}

		GameTexture* MeshMaterial::GetDiffuseMap()
		{
			return diffuseMap;
		}

		GameTexture* MeshMaterial::GetNormalMap()
		{
			return normalMap;
		}

		GameTexture* MeshMaterial::GetSpecularMap()
		{
			return specularMap;
		}

		void MeshMaterial::Dispose()
		{
			if (diffuseMap != NULL)
			{
				diffuseMap->Dispose();
			}

			if (specularMap != NULL)
			{
				specularMap->Dispose();
			}

			if (normalMap != NULL)
			{
				normalMap->Dispose();
			}
		}
	}
}